/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controller;

import java.util.ArrayList;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceUnit;
import javax.persistence.Query;

/**
 *
 * @author Hernán
 */
public class Horario {
     private int horario[][] = new int[7][96];
    
    
    
    @PersistenceUnit(unitName = "PodologiaPU")
      private EntityManagerFactory emf = Persistence.createEntityManagerFactory("PodologiaPU");

    private EntityManager getEntityManager() {
        return emf.createEntityManager();
    }

    public ArrayList getHorario(int legajo) {
        EntityManager em = getEntityManager();
        try {
            Query q = em.createQuery("SELECT d FROM DiasAtencion d WHERE d.idEmpleado.legajo =" + legajo);
            q.setFirstResult(0);

            return new ArrayList(q.getResultList());
        } finally {
            em.close();


        }
    }


}
